<?php
try {
	/*
	 * 处理考勤信息
     */
	@header ( 'Content-type:text/html;charset=UTF-8' );

	define ( 'MacTop', true );
	define ( 'Root', dirname ( __FILE__ ) );
	require_once Root . '/common.inc.php';
	
	$now=time();


	//六日没考勤
	if(in_array(date('w',$now),array(0,6))){
		exit();
	}
	
	require_once Root . '/function.inc.php';
	GetMyConnection ();

	$attendaceday=date('ymd',$now);
 //   $sql='insert ignore attendance (attendancetypeid,schoolid,classid,studentid,attendaceday,addtime) select 1,b.schoolid,b.classid,a.studentid,'.$attendaceday.','.$now.' from student_class a left join class b on a.classid=b.classid where b.isover=0 and b.isdel=0';
$sql="insert ignore attendance (attendancetypeid,schoolid,classid,studentid,attendaceday,addtime) select 1,b.schoolid,b.classid,a.studentid, FROM_UNIXTIME(UNIX_TIMESTAMP(),'%y%m%d'),UNIX_TIMESTAMP()   from student_class a left join class b on a.classid=b.classid where b.isover=0 and b.isdel=0";
	$result = mysql_query ( $sql, $db );

	CleanUpDB ();
	exit ();
} catch ( Exception $e ) {
	echo $e->getMessage ();
	exit ();
}
?>
